<template>
  <div>
    <div class="delivey2_box">
      <van-icon name="arrow-left" />
    </div>
    <!-- 输入任意文本 -->
    <div class="top1">
      <van-field
        v-model="info.cusName"
        type="value"
        label="客户"
        input-align="right"
      />
      <van-field
        v-model="info.prodName"
        type="value"
        label="商品"
        input-align="right"
      />
      <van-field
        v-model="info.prodNum"
        type="value"
        label="数量"
        input-align="right"
      />
      <van-field
        v-model="info.orderUserName"
        type="value"
        label="下单人"
        input-align="right"
      />
      <van-field
        v-model="info.orderTime"
        type="value"
        label="下单时间"
        input-align="right"
      />
    </div>
    <div>
      <van-field
        v-model="value5"
        type="value"
        label="收货人"
        input-align="right"
      />
      <!-- 输入手机号，调起手机号键盘 -->
      <van-field
        v-model="tel"
        type="tel"
        label="联系电话"
        input-align="right"
      />
      <!-- 允许输入正整数，调起纯数字键盘 -->
      <van-field
        v-model="value6"
        type="value"
        label="收货地址"
        input-align="right"
      />
      <!-- 允许输入数字，调起带符号的纯数字键盘 -->
      <van-field
        v-model="number"
        type="number"
        label="物流单号"
        input-align="right"
      />
    </div>

    <div class="foots">
      <van-button
        class="van_btn"
        type="info"
        size="normal"
        round
        block
        color="blue"
        @click="btn"
        >确认发货信息</van-button
      >
    </div>
  </div>
</template>

<script>
import bus from "@/assets/event-bus";

import { getDeliverySend } from "@/request/api";
export default {
  data() {
    return {
      info: {},
      tel: "",
      value5: "",
      value6: "",
      number: "",
    };
  },
  methods: {
    btn() {
      getDeliverySend({
        // 订单号
        serialNo: this.info.serialNo,
        // 收货人
        receiver: this.value5,
        // 联系电话
        linkPhone: this.tel,
        // 收货地址
        address: this.value6,
        // 物流单号
        logisticsCode: this.number,
      }).then((res) => {
        console.log(res);
        if (res.errCode == 0) {
          // 跳转回 待发货
          this.$router.replace({ name: "Logistics", params: { active: 1 } });
        }
      });
    },
  },
  created() {
    this.info = this.$route.params;
    console.log("路由参数", this.$route.params);
    // this.$route.params;
  },
};
</script>

<style>
.delivey2_box {
  background: blue;
  color: #fff;
  padding: 0.6rem;
}
.top1 {
  margin-bottom: 1rem;
}
.foots {
  width: 100%;
  background: #fff;
  position: fixed;
  bottom: 0;
}
.van_btn {
  width: 90%;
  margin: 0 auto;
}
</style>